package com.lupan.springboot.controller;

import com.lupan.springboot.domain.StudentVo;
import com.wordnik.swagger.annotations.Api;
import com.wordnik.swagger.annotations.ApiOperation;
import com.wordnik.swagger.annotations.ApiParam;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

/**
 * 说明：
 *
 * @author lupan
 * @version 2017/6/6 13:48
 */
@RestController
@Api(value = "StudentController",description = "学生管理")
@RequestMapping("student")
public class StudentController {

    @ApiOperation(value = "添加学生",httpMethod = "POST",response = Void.class,notes = "添加一个学生到数据库")
    @RequestMapping(value = "add",method = RequestMethod.POST)
    public void add(@ApiParam(required = true, value = "学生实体对象") @RequestBody StudentVo student){

    }

    @ApiOperation(value = "获取学生",httpMethod = "GET",response = StudentVo.class,notes = "从数据库获取单个学生数据")
    @RequestMapping(value = "get",method = RequestMethod.GET)
    public StudentVo get(@ApiParam(required = true, value = "学生id") String id){
        StudentVo studentVo = new StudentVo();
        studentVo.setId("1");
        studentVo.setNum("001");
        studentVo.setName("小红");
        return studentVo;
    }
}
